<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户列表</title>

    <link href="../../resource/css/bootstrap.min.css?v=3.3.5" rel="stylesheet" th:href="@{/resource/css/bootstrap.min.css?v=3.3.5}"/>
    <link href="../../resource/css/font-awesome.min.css?v=4.4.0" rel="stylesheet" th:href="@{/resource/css/font-awesome.min.css?v=4.4.0}"/>
    <!-- Morris -->
    <link href="http://cdn.viptool.cn/lib/morris.js/0.4.3/morris.css" rel="stylesheet">
    <link href="../../resource/css/animate.min.css" rel="stylesheet" th:href="@{/resource/css/animate.min.css}"/>
    <link href="../../resource/hotui/css/style.min-1.0.8.css" th:href="@{/resource/hotui/css/style.min-1.0.8.css}" rel="stylesheet">
    <link href="../../resource/hotui/css/hotui.style.override.css" th:href="@{/resource/hotui/css/hotui.style.override.css}" rel="stylesheet"/>
    <link href="../../resource/hotui/js/plugins/datetimepick/css/daterangepicker.css" th:href="@{/resource/hotui/js/plugins/datetimepick/css/daterangepicker.css}" rel="stylesheet"/>

    <style type="text/css">
        .hr-line-dashed {
            margin: 10px 0;
            height: 1px;
            border-top: 1px dashed #e7eaec;
            background-color: #fff;
            color: #fff;
        }

        .city-picker-selector select {

        }

        .daterangepicker {
            z-index: 999999999 !important;
        }

        .nav-tabs input {
            width: 20px;
            height: 23px;
        }
    </style>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight tooltip-demo">
    <!--search-->
    <form role="form" id="searchForm" class="search-panel" method="get" th:object="${condition}">
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox">
                    <div class="ibox-content">
                        <div class="form-inline">
                            <input type="hidden" th:value="${pageIndex}" name="pageIndex"/>
                            <input type="hidden" th:value="*{sellStatus}" name="sellStatus"/>
                            <div class="form-group m-r-sm">
                                <label class=" control-label" for="orderId">订单号：</label>
                                <input type="text" class="form-control input-sm mb10" id="orderId" th:value="*{orderId}" name="orderId" placeholder="订单号" style="width: 156px;"/>
                            </div>
                            <div class="form-group m-r-sm">
                                <label class=" control-label" for="orderId">下单用户：</label>
                                <input type="text" class="form-control input-sm mb10" id="userKey" th:value="*{userKey}" name="userKey" placeholder="用户名/姓名" style="width: 156px;"/>
                            </div>
                        </div>
                        <p style="height: 20px;"></p>
                        <div class="form-inline">
                            <div class="form-group m-r-sm">
                                <label class=" control-label" for="createTimePick">创建时间：</label>
                                <input readonly type="text" class="form-control input-sm mb10 data-range-pick" id="createTimePick" name="createTimePick" start-element="#beginTime" end-element="#endTime" placeholder="开始时间-结束时间" style="width: 377px;"/>
                                <input type="hidden" th:value="*{beginTime}" id="beginTime" name="beginTime"/>
                                <input type="hidden" th:value="*{endTime}" id="endTime" name="endTime"/>
                            </div>
                            <div class="form-group m-r-sm">
                                <button type="button" onclick="orderHandler.search(1)"
                                        class="btn btn-primary btn-sm m-b-none searchBtn">筛选
                                </button>
                                <button type="button" onclick="orderHandler.searchAll()" class="btn btn-primary btn-sm m-b-none">显示全部</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <!--search-->

    <!--list-->
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins m-b-none">
                <div class="tabs-container">
                    <ul class="nav nav-tabs">
                        <li class="active" th:class="${condition.sellStatus==-1?'active':''}">
                            <a th:href="@{/order/wholesale/list}" href="#tab-2">全部</a>
                        </li>
                        <li th:class="${condition.sellStatus==0?'active':''}">
                            <a th:href="@{/order/wholesale/list(sellStatus=0)}">持仓中</a>
                        </li>
                        <li th:class="${condition.sellStatus==1?'active':''}">
                            <a th:href="@{/order/wholesale/list(sellStatus=1)}">待挂卖</a>
                        </li>
                        <li th:class="${condition.sellStatus==2?'active':''}">
                            <a th:href="@{/order/wholesale/list(sellStatus=2)}">已挂卖</a>
                        </li>
                    </ul>
                    <div class="tab-content">
                        <div class="tab-pane active">
                            <div class="panel-body">
                                <table class="table table-bordered table-hover table-center" th:each="order:${orders}">
                                    <thead>
                                    <tr>
                                        <th colspan="12" style="color: #636e7b; padding-bottom: 0px; text-align: left;">
                                            <!-- <div class="checkbox checkbox-default m-b-none m-t-none"
                                                 style="display: inline-block;">
                                                <input th:id="${'chk'+user.userId}" th:value="${user.userId}"
                                                       style="margin-top: 0px; cursor: pointer;" type="checkbox"
                                                       name="chkUser" value="560946"/>
                                                <label th:for="${'chk'+user.userId}"></label></div> -->
                                            <span th:text="${order.orderId}">2019898878798</span>

                                            <p style="float: right;">
                                                <span class="glyphicon glyphicon-time" data-placement="top" data-toggle="tooltip" data-original-title="创建时间"></span>：<span th:text="${#temporals.format(order.createTime,'yyyy-MM-dd HH:mm:ss')}"></span>
                                            </p>
                                        </th>
                                    </tr>
                                    </thead>
                                    <tr>
                                        <td>商品名称</td>
                                        <td>金额</td>
                                        <td>挂卖状态</td>
                                        <td>买家用户名</td>
                                        <td>操作</td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <p style="width: 100%; height: 50px;">
                                                <!--商品-->
                                                <img th:src="${@resourceService.get(order.orderItemPOS.get(0).goodsInfo.thumbnail).getURI()}" style="width: 50px; height: 50px; float: left; margin-left: 5px;" src=""/>
                                                <span th:text="${order.orderItemPOS.get(0).goodsInfo.goodsName}" style="overflow: hidden; text-align: left; margin-left: 10px; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; width: 54%; float: left;">商品名称</span>
                                                <span style="float: right; margin-top: 30px">X<span th:text="${order.orderItemPOS.get(0).num}">1</span></span>
                                            </p>
                                        </td>
                                        <td th:text="${order.finalAmount}">100</td>
                                        <td th:text="${order.sellStatus.desc}">已支付</td>
                                        <td th:text="${order.userPO.getUsername()}">18777876675</td>
                                        <td>
                                            <span th:onclick="orderHandler.detail([[${order.orderId}]])"
                                                  onclick="orderHandler.detail('')" class="cursor-point"><i
                                                    class="fa fa-paste tooltips" data-placement="top"
                                                    data-toggle="tooltip" data-original-title="订单详情"></i></span>
                                        </td>
                                    </tr>
                                    <thead>
                                    <tr>
                                        <th colspan="12" style="color: #636e7b; padding-bottom: 0px; text-align: left;">
                                            <p style="float: right;">
                                                商品数量：<span th:text="${order.goodsNum}">1</span>
                                                &nbsp;
                                                订单金额：￥<span th:text="${order.finalAmount}">2000.00</span>
                                            </p>
                                        </th>
                                    </tr>
                                    </thead>
                                </table>
                                <p style="float: left; margin: 20px 0;">
                                    共<span th:text="${totalRecords}"></span>条记录，当前第<span th:text="${pageIndex}"></span>/<span th:text="${totalPages==0?1:totalPages}"></span>，每页20条记录
                                </p>
                                <ul style="float: right;" class="pagination pagination-split">
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!--基础框架js-->
<script src="../../resource/js/jquery.min.js?v=2.1.4" th:src="@{/resource/js/jquery.min.js?v=2.1.4}"></script>
<script src="../../resource/js/bootstrap.min.js?v=3.3.5" th:src="@{/resource/js/bootstrap.min.js?v=3.3.5}"></script>
<script src="../../resource/hotui/js/hot/bootstrap.hot.extra-utils.js?20190316" th:src="@{/resource/hotui/js/hot/bootstrap.hot.extra-utils.js?20190316}"></script>
<script src="../../resource/hotui/js/hot/bootstrap.hot.extra-init.js?20190316?1234567" th:src="@{/resource/hotui/js/hot/bootstrap.hot.extra-init.js?20190316(123)}"></script>
<script src="../../resource/hotui/js/content.min.js" th:src="@{/resource/hotui/js/content.min.js}"></script>

<script src="../../resource/lib/moment.min.js" th:src="@{/resource/lib/moment.min.js}"></script>
<script src="../../resource/hotui/js/plugins/datetimepick/js/daterangepicker.js"
        th:src="@{/resource/hotui/js/plugins/datetimepick/js/daterangepicker.js}"></script>


<script type="text/javascript" th:inline="javascript">
    const pageIndex = /*[[${pageIndex}]]*/  1;
    const totalPages = /*[[${totalPages}]]*/  0;
    const pageUri = /*[[@{/order/wholesale/list}]]*/  "";
    const detailUri = /*[[@{/order/wholesale/detail}]]*/  "";
</script>

<script>
    $(function () {
        //初始化分页
        var pageinate = new hot.paging(".pagination", pageIndex, totalPages, 7);

        pageinate.init(function (p) {
            orderHandler.search(p);
        });
        $(document).keyup(function (event) {
            if (event.keyCode == 13) {
                $(".searchBtn").trigger("click");
            }
        });
    });

    var orderHandler = {
        search: function (pageIndex) {
            $("input[name=pageIndex]").val(pageIndex);
            $("#searchForm").submit();
        },
        searchAll: function () {
            window.location.href = pageUri;
        },
        detail: function (orderId) {
            hot.newTab(detailUri + "?orderId=" + orderId, "订单详情-" + orderId);
        }
    };
</script>
</body>
</html>
